using System;
using System.Collections.Generic;

public class GameConstants
{
	[Serializable]
	public class CharacterLook
	{
		public Flags flag;

		public string textureName;
	}

	public enum PrefabDef
	{
		Guy1Prefab = 0,
		Girl1Prefab = 1
	}

	public enum Flags
	{
		Czech = 0,
		China = 1,
		Germany = 2,
		UK = 3,
		Japan = 4,
		Romania = 5,
		Russia = 6,
		Korea = 7,
		Sweden = 8,
		US = 9,
		France = 10,
		Italy = 11,
		Poland = 12,
		Spain = 13,
		Australia = 14,
		Austria = 15,
		Brazil = 16,
		Canada = 17,
		Denmark = 18,
		Hungary = 19,
		India = 20,
		Indonesia = 21,
		Malaysia = 22,
		Singapore = 23,
		Vietnam = 24,
		Albania = 25,
		Argentina = 26,
		Belarus = 27,
		Belgium = 28,
		Bulgaria = 29,
		Chile = 30,
		Colombia = 31,
		Croatia = 32,
		Egypt = 33,
		Estonia = 34,
		Finland = 35,
		Greece = 36,
		Iceland = 37,
		Ireland = 38,
		Jamaica = 39,
		Latvia = 40,
		Luxembourg = 41,
		Macedonia = 42,
		Mexico = 43,
		Netherlands = 44,
		NewZealand = 45,
		Norway = 46,
		Portugal = 47,
		Serbia = 48,
		Slovakia = 49,
		Slovenia = 50,
		Switzerland = 51,
		Thailand = 52,
		Turkey = 53,
		Ukraine = 54,
		Bolivia = 55,
		Venezuela = 56
	}

	public class Country
	{
		public Flags flag;

		public string spriteName;

		public string countryName;
	}

	private static GameConstants instance;

	public List<CharacterLook> characters = new List<CharacterLook>();

	public static string[] TournamentNames = new string[25]
	{
		"Kamil Halek", "Hu Chen", "Sandra Bauer", "Anthony Walker", "Ryo Yamada", "Eugeniu Arghezi", "Svetlana Leonova", "Jang Jong-suk", "Lars Lindegren", "Jason Benson",
		"Philippe Marot", "Umberto Evola", "Franciszek Turowski", "Emilio Ferrero", "Wilson Taylor", "Michael Bernhard", "Eduardo da Silva", "Amelia Bouchard", "Harald Kristensen", "Miklos Nagy",
		"Anil Sharma", "Hamsad Hadi", "Afifi Wong", "Chun Yi Ng", "Hung Nguyen"
	};

	private List<Country> countries = new List<Country>();

	private string[] chibiTextureFilenames;

	private string[] fallbackChibiTextureFilenames;

	public static GameConstants Instance
	{
		get
		{
			if (instance == null)
			{
				instance = new GameConstants();
				instance.Init();
			}
			return instance;
		}
	}

	public List<Country> Countries
	{
		get
		{
			return countries;
		}
	}

	public static void SetFlag(UISprite sprite, Flags flag)
	{
		SetFlag(sprite, (int)flag);
	}

	public static void SetFlag(UISprite sprite, string name)
	{
		GameConstants gameConstants = Instance;
		Country country = gameConstants.CountryForName(name);
		if (country != null)
		{
			SetFlag(sprite, country.flag);
		}
	}

	public static void SetFlag(UISprite sprite, int flag)
	{
		GameConstants gameConstants = Instance;
		if (gameConstants != null && !(sprite == null))
		{
			Country country = gameConstants.CountryForFlag(flag);
			if (country != null)
			{
				sprite.spriteName = country.spriteName;
			}
		}
	}

	public Country CountryForName(string name)
	{
		name = name.ToLower();
		foreach (Country country in countries)
		{
			if (name == country.countryName.ToLower())
			{
				return country;
			}
		}
		return null;
	}

	public CharacterLook characterForFlag(int flag)
	{
		CharacterLook result = characters[0];
		foreach (CharacterLook character in characters)
		{
			if (character.flag == (Flags)flag)
			{
				result = character;
				break;
			}
		}
		return result;
	}

	public Country CountryForFlag(int flag)
	{
		foreach (Country country in countries)
		{
			if (country.flag == (Flags)flag)
			{
				return country;
			}
		}
		return countries[0];
	}

	protected void Init()
	{
		Flags[] array = (Flags[])Enum.GetValues(typeof(Flags));
		countries.Clear();
		Flags[] array2 = array;
		for (int i = 0; i < array2.Length; i++)
		{
			Flags flags = array2[i];
			if (flags == Flags.NewZealand)
			{
				countries.Add(new Country
				{
					flag = flags,
					spriteName = "new-zeland-flag",
					countryName = "New Zealand"
				});
			}
			else
			{
				countries.Add(new Country
				{
					flag = flags,
					spriteName = flags.ToString().ToLower() + "-flag",
					countryName = flags.ToString()
				});
			}
		}
	}
}
